<template>
  <div class="app-container">
    <el-row :gutter="20">
      <!--部门数据-->
      <el-col :span="4" :xs="24">
        <div class="head-container">
          <SaCommonTreeBiz :editable="true"
                           :kind-id="roleKindId"
                           @tree-loaded="roleFolderFilter"
                           @node-click="handleNodeClick"
                           @node-delete="handleDeleteRole"/>
        </div>
      </el-col>
      <el-col :span="20" :xs="24">
        <!-- 搜索工作栏 -->
        <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
                 label-width="68px">
          <el-form-item label="编码" prop="code">
            <el-input v-model="queryParams.code" placeholder="请输入编码" clearable @keyup.enter.native="handleQuery"/>
          </el-form-item>
          <el-form-item label="名称" prop="name">
            <el-input v-model="queryParams.name" placeholder="请输入名称" clearable @keyup.enter.native="handleQuery"/>
          </el-form-item>
          <el-form-item label="状态" prop="status">
            <el-select v-model="queryParams.status" placeholder="请选择1 启用 0 禁用" clearable size="small">
              <el-option v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)"
                         :key="dict.value" :label="dict.label" :value="dict.value"/>
            </el-select>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
            <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
          </el-form-item>
        </el-form>
        <!-- 操作工具栏 -->
        <el-row :gutter="10" class="mb8">
          <el-col :span="1.5">
            <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleFolderModule"
                       v-if="!!currentCommonTree.id"
                       v-hasPermi="['sa:role-folder-module:config']">分类模块配置
            </el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleFolderUser"
                       v-if="!!currentCommonTree.id"
                       v-hasPermi="['sa:role-folder-module:config']">分类人员配置
            </el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
                       v-if="!!currentCommonTree.id"
                       v-hasPermi="['sa:role:create']">新增角色
            </el-button>
          </el-col>
          <!--          <el-col :span="1.5">
                      <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
                                 :loading="exportLoading"
                                 v-hasPermi="['sa:role:export']">导出
                      </el-button>
                    </el-col>-->
          <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
        </el-row>

        <!-- 列表 -->
        <el-table v-loading="loading" :data="list">
          <!--          <el-table-column label="ID" align="center" prop="id"/>-->
          <!--          <el-table-column label="角色类型" align="center" prop="roleKindId"/>-->
          <el-table-column label="编码" align="center" prop="code"/>
          <el-table-column label="名称" align="center" prop="name"/>
          <el-table-column label="描述" align="center" prop="description"/>
          <el-table-column label="状态" align="center" prop="status">
            <template v-slot="scope">
              <dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status"/>
            </template>
          </el-table-column>
          <el-table-column label="排序号" align="center" prop="sequence"/>
          <el-table-column label="创建日期" align="center" prop="createTime" width="180">
            <template v-slot="scope">
              <span>{{ parseTime(scope.row.createTime) }}</span>
            </template>
          </el-table-column>
          <el-table-column label="更新日期" align="center" prop="updateTime" width="180">
            <template v-slot="scope">
              <span>{{ parseTime(scope.row.updateTime) }}</span>
            </template>
          </el-table-column>
          <el-table-column label="操作" align="center" class-name="small-padding fixed-width" min-width="180">
            <template v-slot="scope">
              <el-button size="mini" type="text" icon="el-icon-edit" @click="handleAllocation(scope.row)"
                         v-hasPermi="['sa:role:allocation']">菜单权限
              </el-button>
              <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
                         v-hasPermi="['sa:role:update']">修改
              </el-button>
              <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
                         v-hasPermi="['sa:role:delete']">删除
              </el-button>
            </template>
          </el-table-column>
        </el-table>
        <!-- 分页组件 -->
        <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
                    @pagination="getList"/>
      </el-col>
    </el-row>
    <!-- 对话框(添加 / 修改) -->
    <el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="所属分类" prop="folderName">
          <el-input v-model="form.folderName" placeholder="请输入所属分类" disabled/>
        </el-form-item>
        <el-form-item label="编码" prop="code">
          <el-input v-model="form.code" placeholder="请输入编码"/>
        </el-form-item>
        <el-form-item label="名称" prop="name">
          <el-input v-model="form.name" placeholder="请输入名称"/>
        </el-form-item>
        <el-form-item label="类型" prop="roleKindId">
          <el-input v-model="form.roleKindId" placeholder="请输入角色类型"/>
        </el-form-item>
        <el-form-item label="描述">
          <el-input v-model="form.description" :min-height="192"/>
        </el-form-item>
        <!--        <el-form-item label="父角色名称" prop="parentRoleNames">
                  <el-input v-model="form.parentRoleNames" placeholder="请输入父角色名称"/>
                </el-form-item>-->
        <el-form-item label="状态" prop="status">
          <el-radio-group v-model="form.status">
            <el-radio v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)"
                      :key="dict.value" :label="parseInt(dict.value)">{{ dict.label }}
            </el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="排序号" prop="sequence">
          <el-input type="number" v-model="form.sequence" placeholder="请输入排序号"/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <!--    菜单弹出窗口-->
    <el-dialog title="菜单权限" :visible.sync="openMenu" width="500px" append-to-body>
      <el-form :model="menuForm" label-width="80px">
        <el-form-item label="角色名称">
          <el-input v-model="menuForm.name" :disabled="true"/>
        </el-form-item>
        <el-form-item label="角色标识">
          <el-input v-model="menuForm.code" :disabled="true"/>
        </el-form-item>
        <el-form-item label="菜单权限">
          <el-checkbox v-model="menuExpand" @change="handleCheckedTreeExpand($event, 'menu')">展开/折叠</el-checkbox>
          <el-checkbox v-model="menuNodeAll" @change="handleCheckedTreeNodeAll($event, 'menu')">全选/全不选</el-checkbox>
          <el-tree class="tree-border" :data="menuOptions" show-checkbox ref="menu" node-key="id"
                   :check-strictly="menuForm.menuCheckStrictly" empty-text="加载中，请稍后" :props="menuTreeProps"></el-tree>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitMenu">确 定</el-button>
        <el-button @click="cancelMenu">取 消</el-button>
      </div>
    </el-dialog>
    <!--    菜单弹出窗口-->
    <el-dialog title="菜单权限" :visible.sync="openFolderModule" width="600px" append-to-body>
      <el-form :model="folderModuleForm" ref="folderModuleForm" label-width="120px">
        <el-form-item label="角色分类名称">
          <el-input v-model="folderModuleForm.name" :disabled="true"/>
        </el-form-item>
        <el-form-item label="角色分类标识">
          <el-input v-model="folderModuleForm.code" :disabled="true"/>
        </el-form-item>
        <el-form-item label="菜单模块">
          <el-tree class="tree-border" :data="folderConfigMenuOptions" show-checkbox ref="menu2" node-key="id"
                   :check-strictly="folderModuleForm.menuCheckStrictly" empty-text="加载中，请稍后"
                   :props="menuTreeProps"></el-tree>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFolderModule">确 定</el-button>
        <el-button @click="cancelFolderModule">取 消</el-button>
      </div>
    </el-dialog>
    <!--    角色分类分配人员弹出窗口-->
    <el-dialog title="管理人员分配" :visible.sync="openFolderUser" width="1200px" height="600" append-to-body>
      <el-row :gutter="10" class="mb8">
        <el-col :span="1.5">
          <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleUserPicker">添加管理人员</el-button>
          <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleUserPicker_reader">添加使用人员
          </el-button>

        </el-col>
        <right-toolbar showSearch.sync="true" @queryTable="getFolderUserList"></right-toolbar>
      </el-row>
      <el-table v-loading="folderUserTableloading"
                height="400"
                :data="folderUserList"
                border>
        <!--          <el-table-column label="ID" align="center" prop="id"/>-->
        <el-table-column label="姓名" align="center" prop="name" show-overflow-tooltip/>
        <el-table-column label="路径" align="center" prop="fullName" min-width="200" show-overflow-tooltip/>
        <el-table-column label="权限" align="center" prop="authType" min-width="60" show-overflow-tooltip>
          <template v-slot="scope">
            {{ filterAuthTypeText(scope.row.authType) }}
          </template>
        </el-table-column>
        <el-table-column label="状态" align="center" prop="status">
          <template v-slot="scope">
            <dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status"/>
          </template>
        </el-table-column>
        <el-table-column label="创建日期" align="center" prop="createTime" width="180">
          <template v-slot="scope">
            <span>{{ parseTime(scope.row.createTime) }}</span>
          </template>
        </el-table-column>
        <el-table-column label="创建人" align="center" prop="creator" width="80" />
        <el-table-column label="操作" align="center" class-name="small-padding fixed-width" min-width="100">
          <template v-slot="scope">
            <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDeleteRoleFolderUser(scope.row)"
                       v-hasPermi="['sa:role-folder-user:delete']">删除
            </el-button>
          </template>
        </el-table-column>
      </el-table>
      <!-- 分页组件 -->
      <pagination v-show="folderUserTotal > 0" :total="folderUserTotal" :page.sync="folderUserQueryParams.pageNo"
                  :limit.sync="folderUserQueryParams.pageSize"
                  @pagination="getFolderUserList"/>

      <div slot="footer" class="dialog-footer">
        <el-button @click="cancelFolderUser">关闭</el-button>
      </div>
    </el-dialog>
    <el-dialog title="人员选择" :visible.sync="openUserPicker" width="1200px" append-to-body style="text-align: center;">
      <SaUserPicker @complete="getUserList" @close="openUserPicker = false"/>
    </el-dialog>
  </div>
</template>

<script>
import {
  createRole,
  updateRole,
  deleteRole,
  getRole,
  getRolePage,
  exportRoleExcel,
  createRoleFolderModule,
  getRoleFolderModule,
  updateRoleFolderModule,
  createRoleFolderUser,
  getRoleFolderUserPage,
  deleteRoleFolderUser,
  getMyRoleFolderList
} from "@/api/sa/role";
import {
  getOrg,
  getOrgPage,
  queryOrgTree
} from "@/api/sa/org";
import {assignPermission, listRolePermission} from "@/api/sa/permission";
import {getCommonTreeList} from "@/api/sa/commonTreeBiz";
import Editor from '@/components/Editor';
import SaUserPicker from '@/components/SaPersonPicker';
import SaCommonTreeBiz from '@/components/SaCommonTreeBiz';
import {COMMON_TREE, CommonStatusEnum, FOLDER_USER_AUTH_TYPE} from "@/utils/constants";
import {listSimpleMenus} from "@/api/system/menu";

export default {
  name: "Role",
  components: {
    Editor,
    SaCommonTreeBiz,
    SaUserPicker
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      defaultProps: {
        children: "children",
        label: "name"
      },
      treeOptions: [],
      currentCommonTree: {},
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 角色 列表
      list: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNo: 1,
        pageSize: 10,
        code: null,
        name: null,
        status: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {},
      // 是否显示菜单分配窗口
      openMenu: false,
      menuForm: {},
      menuTreeProps: {
        label: "name",
        children: "children"
      },
      menuOptions: [],
      menuExpand: {},
      menuNodeAll: {},
      openFolderModule: false,
      folderConfigMenuOptions: [],
      folderModuleForm: {},
      openFolderUser: false,
      folderUserTableloading: false,
      folderUserTotal: 0,
      folderUserQueryParams: {
        pageNo: 1,
        pageSize: 10,
      },
      roleKindId: COMMON_TREE.ROLE.id,
      folderUserList: [],
      folderUserType: 1,
      openUserPicker: false
    };
  },

  created() {
    this.getList();
  },
  methods: {
    filterAuthTypeText(authType) {
      return !!authType ? authType == FOLDER_USER_AUTH_TYPE.MANAGER.id ? FOLDER_USER_AUTH_TYPE.MANAGER.name : FOLDER_USER_AUTH_TYPE.READER.name : ''
    },
    // 过滤有管理权限权限角色树节点。
    roleFolderFilter(treeNodeList, resolve) {
      if (!treeNodeList) {
        resolve(treeNodeList)
        return
      }
      // 查询有权限的角色目录
      getMyRoleFolderList(FOLDER_USER_AUTH_TYPE.MANAGER.id).then(response => {
        let folderIdMap = {}
        response.data.forEach(id => {
          folderIdMap[id] = 1
        })
        let treeData = []
        treeNodeList = !!treeNodeList ? treeNodeList : []
        treeNodeList.forEach(row => {
          if (row.parentId == COMMON_TREE.ROOT.id || folderIdMap[row.id] === 1) {
            treeData.push(row);
          }
        })
        resolve(treeData)
      })

    },
    handleNodeClick(data) {
      this.currentCommonTree = data
      this.queryParams.folderId = data.id
      this.getList()

    },
    handleDeleteRole(data, okFunc, cancelFunc) {
      okFunc(true)
    },

    /** 查询列表 */
    getList() {
      this.loading = true;
      // 执行查询
      getRolePage(this.queryParams).then(response => {
        this.list = response.data.list;
        this.total = response.data.total;
        this.loading = false;
      });
    },
    /** 取消按钮 */
    cancel() {
      this.open = false;
      this.reset();
    },
    /** 表单重置 */
    reset() {
      this.form = {
        id: undefined,
        folderId: undefined,
        roleKindId: undefined,
        code: undefined,
        name: undefined,
        description: undefined,
        status: undefined,
        sequence: undefined
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNo = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.form.folderId = this.currentCommonTree.id
      this.form.folderName = this.currentCommonTree.name
      this.form.status = CommonStatusEnum.ENABLE
      this.open = true;
      this.title = "添加角色 ";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id;
      getRole(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改角色 ";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (!valid) {
          return;
        }
        // 修改的提交
        if (this.form.id != null) {
          updateRole(this.form).then(response => {
            this.$modal.msgSuccess("修改成功");
            this.open = false;
            this.getList();
          });
          return;
        }
        // 添加的提交
        createRole(this.form).then(response => {
          this.$modal.msgSuccess("新增成功");
          this.open = false;
          this.getList();
        });
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const id = row.id;
      this.$modal.confirm('是否确认删除角色 编号为"' + id + '"的数据项?').then(function () {
        return deleteRole(id);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {
      });
    },
    /** 导出按钮操作 */
    handleExport() {
      // 处理查询参数
      let params = {...this.queryParams};
      params.pageNo = undefined;
      params.pageSize = undefined;
      this.$modal.confirm('是否确认导出所有角色 数据项?').then(() => {
        this.exportLoading = true;
        return exportRoleExcel(params);
      }).then(response => {
        this.$download.excel(response, '角色 .xls');
        this.exportLoading = false;
      }).catch(() => {
      });
    },

    /** 分配功能按钮操作 */
    async handleAllocation(row) {

      // 检查角色分类权限
      row.moduleid = row.moduleid || this.currentCommonTree.moduleid
      if (!row.moduleid) {
        await getRoleFolderModule(row.folderId).then(response => {
          row.moduleid = response.data ? response.data.moduleid : undefined
        })
      }
      if (!row.moduleid) {
        this.$modal.msgError("角色所属分类未设置菜单模块，无法对该角色进行菜单权限分配");
        return
      }

      const id = row.id
      // 处理了 form 的角色 name 和 code 的展示
      this.menuForm.roleId = id;
      this.menuForm.name = row.name;
      this.menuForm.code = row.code;
      this.menuForm.moduleid = row.moduleid;
      // 打开弹窗
      this.openMenu = true;

      // 获得菜单列表
      listSimpleMenus().then(response => {
        // 处理 menuOptions 参数
        this.menuOptions = [];
        // 过滤当前角色分类拥有的模块。
        let data = this.handleTree(response.data, "id")
        let newData = []
        if (!!data) {
          data.filter(item => {
            if ((',' + row.moduleid + ',').indexOf(',' + item.id + ',') > -1) {
              newData.push(item)
            }
          })
        }
        this.menuOptions.push(...newData);
        // 获取角色拥有的菜单权限
        listRolePermission(id).then(response => {
          // 设置为严格，避免设置父节点自动选中子节点，解决半选中问题
          this.form.menuCheckStrictly = true
          // 设置选中
          this.$refs.menu.setCheckedKeys(response.data);
          // 设置为非严格，继续使用半选中
          this.form.menuCheckStrictly = false
        })
      });
    },

    // 树权限（展开/折叠）
    handleCheckedTreeExpand(value, type) {
      let treeList = this.menuOptions;
      for (let i = 0; i < treeList.length; i++) {
        this.$refs.menu.store.nodesMap[treeList[i].id].expanded = value;
      }
    },
    // 树权限（全选/全不选）
    handleCheckedTreeNodeAll(value, type) {
      this.$refs.menu.setCheckedNodes(value ? this.menuOptions : []);

    },
    // 树权限（父子联动）
    handleCheckedTreeConnect(value, type) {
      this.form.menuCheckStrictly = value;
    },

    cancelMenu() {
      this.openMenu = false
    },
    submitMenu() {
      if (this.menuForm.roleId !== undefined) {
        assignPermission({
          roleId: this.menuForm.roleId,
          menuIds: [...this.$refs.menu.getCheckedKeys(), ...this.$refs.menu.getHalfCheckedKeys()]
        }).then(response => {
          this.$modal.msgSuccess("修改成功");
          this.openMenu = false;
          this.getList();
        });
      }
    },

    /** 新增按钮操作 */
    async handleFolderModule() {

      //加载 角色分类模块数据
      if (!this.currentCommonTree.moduleid) {
        await getRoleFolderModule(this.currentCommonTree.id).then(response => {
          this.currentCommonTree.moduleid = response.data ? response.data.moduleid : ''
        })
      }

      this.folderModuleForm = {}
      this.resetForm("folderModuleForm");
      const id = this.currentCommonTree.id
      this.folderModuleForm.roleFolderId = this.currentCommonTree.id
      this.folderModuleForm.name = this.currentCommonTree.name
      this.folderModuleForm.code = this.currentCommonTree.code
      this.openFolderModule = true;
      // 获得菜单列表
      listSimpleMenus().then(response => {
        // 处理 menuOptions 参数
        this.folderConfigMenuOptions = [];
        let data = this.handleTree(response.data, "id")
        if (!!data) {
          data.filter(item => {
            // 只展示一级功能模块，不展示子级菜单
            delete item.children
          })
        }
        this.folderConfigMenuOptions.push(...data);
        // 获取角色拥有的菜单权限
        getRoleFolderModule(id).then(response => {
          // 设置为严格，避免设置父节点自动选中子节点，解决半选中问题
          this.folderModuleForm.menuCheckStrictly = true
          // 设置选中
          this.$refs.menu2.setCheckedKeys([]);
          if (!!response.data && response.data.moduleid) {
            let data = response.data.moduleid.split(',')
            this.$refs.menu2.setCheckedKeys(data);
            this.folderModuleForm.id = response.data.id
          }
          // 设置为非严格，继续使用半选中
          this.folderModuleForm.menuCheckStrictly = false
        })
      });
      this.title = "分类模块配置 ";
    },
    cancelFolderModule() {
      this.openFolderModule = false
    },
    submitFolderModule() {
      let moduleid = this.$refs.menu2.getCheckedKeys().join(",")
      if (this.folderModuleForm.id !== undefined) {
        // 更新
        updateRoleFolderModule({
          id: this.folderModuleForm.id,
          roleFolderId: this.folderModuleForm.roleFolderId,
          moduleid: moduleid
        }).then(response => {
          this.$modal.msgSuccess("修改成功");
          this.openFolderModule = false;
          this.currentCommonTree.moduleid = moduleid
          this.getList();
        });

        return
      }
      // 新增
      createRoleFolderModule({
        roleFolderId: this.folderModuleForm.roleFolderId,
        moduleid: this.$refs.menu2.getCheckedKeys().join(",")
      }).then(response => {
        this.$modal.msgSuccess("修改成功");
        this.openFolderModule = false;
        this.currentCommonTree.moduleid = moduleid
        this.getList();
      });
    },

    handleFolderUser() {
      this.openFolderUser = true
      this.getFolderUserList()
    },
    cancelFolderUser() {
      this.openFolderUser = false
      this.getFolderUserList()
    },
    handleUserPicker() {
      this.openUserPicker = true
      this.folderUserAuthType = FOLDER_USER_AUTH_TYPE.MANAGER.id
    },
    // 添加使用人员
    handleUserPicker_reader() {
      this.openUserPicker = true
      this.folderUserAuthType = FOLDER_USER_AUTH_TYPE.READER.id
    },
    getFolderUserList() {
      this.folderUserTableloading = true
      this.folderUserQueryParams.roleFolderId = this.currentCommonTree.id
      console.log(this.folderUserQueryParams)
      getRoleFolderUserPage(this.folderUserQueryParams).then(response => {
        this.folderUserList = response.data.list
        this.folderUserTotal = response.data.total
        this.folderUserTableloading = false
      })
    },
    getUserList(userList) {
      let data = []
      userList.forEach(item => {
        let d = {
          roleFolderId: this.currentCommonTree.id,
          orgInId: item.id,
          authType: this.folderUserAuthType
        }
        data.push(d)
      })
      createRoleFolderUser(data).then(res => {
        this.$modal.msgSuccess("添加成功");
        this.getFolderUserList()
      })
    },

    /** 删除按钮操作 */
    handleDeleteRoleFolderUser(row) {
      const id = row.id;
      this.$modal.confirm('是否确认删除数据项?').then(function () {
        return deleteRoleFolderUser(id);
      }).then(() => {
        this.getFolderUserList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {
      });
    },
  }
};
</script>
